/*
 * Universidad del Valle de Guatemala
 * Algoritmos y Base de Datos
 * Juan Fernando Moraflores Cifuentes, 12938
 * Carlos Sagastume, 12113
 * 
 */
package lector;

import java.io.*;



public class Lector {

    public static void main(String[] args)throws IOException {
     
        int c= 0;
        Pila objeto1 = new Pila();
        int w=0;
        int v =0;
        int i = 0;//contador de caracteres
        int y= 0;
        Object[] vectoroperando  = new Object[40];
        boolean contador1= false;

        FileReader inputStream = null;
       //ESte es el primer ciclo; aquí se pone el contador
        try {
            inputStream = new FileReader("prueba.txt");
           while ((c = inputStream.read()) !=  -1) {
                 i = i+1;
                 }
            System.out.println("El nuemro total de caracteres\t" +i);
        } finally {
            if (inputStream != null) {
                inputStream.close();
            }
          }
        
    Object[] vectorentrada = new Object[i];
    int[] vectorr= new int[i];
    String[] vectorrr = new String[i];
      //  System.out.println("joder" +i); 
  //ESte es el segundo ciclo:: aqui se analiza cada character 
        
        try {
            inputStream = new FileReader("prueba.txt");
          while ((c = inputStream.read()) != -1) {
        
                 v=v+1; 
               // System.out.println("" + (char)c);                
               vectorentrada[v] = (char)c;
             //  System.out.println(""+vectorentrada[v]);
               
     if(c>41 && c<59){
         y=y+1;
            vectoroperando[y] = (char)c;
           // System.out.println("ewew");
           // System.out.println(""+vectoroperando[y]);
            vectorr[y]=(Integer)c;
            //System.out.println("kkkkk"+vectorr[y]);
            vectorrr[y]= "" +(char)c;
           // System.out.println("kkkkdsfa" +vectorrr[y]);
            objeto1.setInput(vectorr);
            //System.out.println(""+(char)vectorr[y]);
            objeto1.setInput1(vectorrr);
          // System.out.println("fjdskfs");
            objeto1.Pop();
           // System.out.println("fjdskfjdskkkk");
                if (c>41 && c<48){
                   // objeto1.Pop((char)c);
                 // System.out.println(""+(char)c);
                // System.out.println("dkjdksfkj");
               // System.out.println("" + (char)c);
              // vectoroperando[w]=(char)c;        
             //System.out.println("   joder   " + vectoroperando[w] + "   JODER    ");
               } else if (c>48 && c<59){
                 w=w+1;
                 objeto1.setJ(w);
                   objeto1.Push((char)c);
          
          }}
            }
         
        } finally {
            if (inputStream != null) {
                inputStream.close();
            }
          
            }
       
    }
}
    

